package com.awei.project.Controller;

import java.util.Calendar;
import java.util.Date;

import com.awei.project.mapper.UserTeamMapper;
import com.awei.project.model.entity.Team;
import com.awei.project.model.entity.UserTeam;
import com.awei.project.service.TeamService;
import com.awei.project.service.UserTeamService;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

import javax.annotation.Resource;

/**
 * @author 小维哥
 * @version 1.2
 */
@SpringBootTest
public class addUserTeam {
        @Resource
        UserTeamService userTeamService;
        @Resource
        TeamService teamService;

        @Test
        public void addUserTeam() {
                UserTeam userTeam;
                for (long i = 1; i < 6; i++) {
                        userTeam = new UserTeam();
                        userTeam.setUserId(i);
                        userTeam.setTeamId(i);
                        userTeam.setJoinTime(new Date());
                        userTeam.setCreateTime(new Date());
                        userTeam.setUpdateTime(new Date());
                        userTeam.setIsDelete(0);
                        userTeamService.save(userTeam);
                }
        }

        @Test
        public void addTeam() {
                Team team;
                Calendar currentCal = Calendar.getInstance();
                currentCal.add(Calendar.DAY_OF_WEEK,1);
                Date futureTime = currentCal.getTime();
                for (long i = 1; i < 6; i++) {
                        team = new Team();
                        team.setId(i);
                        team.setName("昆仑仙宫");
                        team.setDescription("超级超级无敌宗门，是兄弟，就加入我们！！");
                        team.setMaxNum(5);
                        team.setExpireTime(futureTime);
                        team.setUserId(i);
                        team.setStatus(0);
                        team.setPassword("");
                        teamService.save(team);
                }

        }
}
